package com.hm.oper_monitor.ui.tab;

import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum TabPanelMnemonicEnum {
	set("set", KeyEvent.VK_1),
	busi("1", KeyEvent.VK_2);
	
	private final String tabName;
	private final int mnemonic;

    private TabPanelMnemonicEnum(String tabName, int mnemonic) {
		this.tabName = tabName;
		this.mnemonic = mnemonic;
	}

	public String getTabName() {
		return tabName;
	}

	public int getMnemonic() {
		return mnemonic;
	}

	public static int parse(String tabName) {
        for (TabPanelMnemonicEnum s : TabPanelMnemonicEnum.values()) {
            if (s.tabName.equals(tabName)) {
                return s.mnemonic;
            }
        }
        return KeyEvent.VK_ESCAPE;
    }
    
    public static List<Map<String, String>> getAllEnum() {
        List<Map<String, String>> l = new ArrayList<Map<String, String>>();
        TabPanelMnemonicEnum[] s = TabPanelMnemonicEnum.values();
        for (TabPanelMnemonicEnum e : s) {
            Map<String, String> maps = new HashMap<String, String>();
            maps.put("tabName", e.tabName);
            maps.put("mnemonic", String.valueOf(e.mnemonic));
            l.add(maps);
        }
        return l;
    }
}
